Skip to content

Instantly share code, notes, and snippets.

Avatar
🙉
I have no idea what I'm doing

Piotr Czajkowski pczajkowski

🙉
I have no idea what I'm doing
View GitHub Profile
@pczajkowski
pczajkowski / NoDuplicatedSource.cs
Created Jun 24, 2021
Remove segments where source is duplicated from TMX file while streaming it
View NoDuplicatedSource.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
namespace DuplicatesInTMX
{
class Program
{
View archLister.c
#define _GNU_SOURCE //asks stdio.h to include asprintf
#include <archive.h>
#include <archive_entry.h>
#include <stdlib.h>
#include <string.h>
#include "stopif.h"
char* printFileSize(long int size){
char *fileSize;
View csvtest.c
/*
csvtest - reads CSV data from stdin and output properly formed equivalent
useful for testing the library
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
View translations.txt
constant "someID", "sourceText"
translation
constant "someOtherID", "otherSourceText
which is multiline"
another translation
View epidemic.js
const WIDTH = 8;
const HEIGHT = 8;
// https://www.coding-dojo-silesia.pl/golf
function point_free(x, y, people) {
const pLength = people.length;
for (let i = 0; i < pLength; i++) {
const person = people[i];
if (x === person.x && y === person.y)
View printTextForGivenElement.js
const fs = require('fs');
const cheerio = require('cheerio');
const puppeteer = require('puppeteer');
let app = {};
app.parse = async function(data, elementSelector) {
if (data.length === 0) {
console.log("No data!");
return;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am pczajkowski on github.
  • I am pczajkowski (https://keybase.io/pczajkowski) on keybase.
  • I have a public key whose fingerprint is 661E A005 5FE5 39D5 5B06 2876 9AF4 CFB6 E475 1A47

To claim this, I am signing this object:

@pczajkowski
pczajkowski / mergePDFs.cs
Last active Sep 25, 2019
PoC to demonstrate how easy it is to merge PDFs. Based on https://stackoverflow.com/a/808699/7342859
View mergePDFs.cs
using System;
using System.IO;
using System.Linq;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
namespace MergePDFs
{
internal class Program
{
View AppName.cs
public string AppName
{
get
{
if (!string.IsNullOrEmpty(_appName))
return _appName;
var name = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
if (string.IsNullOrEmpty(name))
throw new Exception("Can't establish app name!");
View downloadsEachTMInParallel.cs
private static async Task<List<string>> DownloadTMXsAsync(List<TMInfo> tms)
{
List<Task> tasks = new List<Task>();
List<string> tmxs = new List<string>();
foreach (var tm in tms)
{
tasks.Add(Task.Run(async () =>
{
var result = await _memoQTM.DownloadTMXAsync(".", tm.Guid);
if (result.status.Equals("ok", StringComparison.InvariantCultureIgnoreCase))