Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<unistd.h>
#define SIZE_4K 1024*4
int getFileSize(char * strFileName)
#!/usr/bin/python
"""
Script to offset the time in subtitle files in the .srt format. Script
takes in the filename and the offset (in milliseconds) to add or
subtract from the subtitles. It then writes the new subtitles to the
same file. Alternately you can specify the filename as '-' and then
the script will read input from stdin and write output to stdout.
"""
// Generated by gfwlist2pac
// https://github.com/clowwindy/gfwlist2pac
var domains = {
// "github.com": 1,
"xda-developers.com": 1,
"googleapis.com": 1,
"gmail.com" : 1,
"googlesource.com": 1,
"google.com": 1,
@lygstate
lygstate / configure.py
Last active August 29, 2015 14:19 — forked from luser/configure.py
import argparse
import fnmatch
import os
import string
import subprocess
import sys
from collections import defaultdict
SUBSTS = set(['MOZ_PERMISSIONS', 'MOZ_DMD', 'HAVE_64BIT_BUILD', 'MOZ_CAN_RUN_PROGRAMS', 'MOZ_WIDGET_TOOLKIT', 'MOZ_PNG_ARM_NEON_CHECK', 'MOZ_ALLOW_HEAP_EXECUTE_FLAGS', 'AR_EXTRACT', 'TAR', 'MOZ_SERVICES_COMMON', 'MOZ_VPX_ERROR_CONCEALMENT', 'ZLIB_IN_MOZGLUE', 'MOZ_JPROF', 'MOZ_SOCIAL', 'NONASCII', 'MOZ_MULET', 'VPX_ASFLAGS', 'MOZ_APP_ID', 'MOZ_NO_EV_CERTS', 'MOZ_PNG_CFLAGS', 'MOZ_CHILD_PROCESS_NAME', 'MOZ_OPUS', 'OBJCOPY', 'ASM_SUFFIX', 'MOZ_WEBSPEECH', 'MOZ_FIX_LINK_PATHS', 'GRE_MILESTONE', 'HOST_LDFLAGS', 'VISIBILITY_FLAGS', 'TARGET_MD_ARCH', 'MOZ_ASAN', 'MOZ_APP_UA_NAME', 'GST_API_VERSION', 'MOZ_DEVICES', 'MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS', 'MOZ_SERVICES_HEALTHREPORT', 'MOZ_JPEG_CFLAGS', 'MOZ_B2G_FM', 'MOZ_B2G_RIL', 'MOZ_ANDROID_OMTC', 'MOZ_METRO', 'DSO_LDOPTS', 'MOZ_OPTIMIZE_LDFLAGS', 'MOZ_DISABLE_PARENTAL_CONTROLS', 'OS_LDFLAGS', '_MSC_VER', 'MKSHLIB_FORCE_ALL', 'MOZ_NUWA_PROCESS'
@lygstate
lygstate / archive.py
Last active August 29, 2015 14:24 — forked from Eccenux/archive.py
#!/usr/bin/env python
import os
import zipfile
"""
Helper class that lets one add whole directory contents.
License
--------------------
@lygstate
lygstate / A better IndexedDB IMHO.md
Created October 28, 2015 01:58 — forked from netroy/A better IndexedDB IMHO.md
A better IndexedDB IMHO

--------- Work In progress ---------

##Context Multiple discussion threads spun out after this tweet mentioning my talk on Full-Text Search in IndexedDB using Inverted Indices at BerlinJS.

Only the beginning of my talk was about my discontent with the current IDB API and how it is a much needed technology. Unfortunately it's not terrific as a spec and has rather messy implementations across browsers. The API is way too low-level and needs a decent amount of abstraction for everyday web-developers to work with it.

Sharing my slides isn't going to be of much help, and neither is discussing about them in 140 chars.

@lygstate
lygstate / glfwAngle.cpp
Last active July 14, 2016 10:54
glfw with gis
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#define esLogMessage printf
typedef struct
{
// Handle to a program object
GLuint programObject;
@lygstate
lygstate / gist:8262ecbef452dc668e30d40c5795bb06
Last active December 25, 2019 16:18
Full log of ld.lld 9.0.1 coredump for chromium 78 on alpine
Undefined set logging command: "getTypeId.log". Try "help set logging".
Currently logging to "gdb.txt".
Future logs will be written to getTypeId.log.
Logs will be appended to the log file.
Output will be logged and displayed.
Thread 9 (LWP 254):
#0 0x000055f062d9fb2f in AddNodeIDCustom (ID=..., N=0x55f087e2f408) at /home/builder/package/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1564
C = 0x55f087e2f408
GA = <optimized out>
@lygstate
lygstate / gist:daf6b45d37ee312c0141f717487e442b
Created December 25, 2019 18:16
core.1577296122.ld.lld.45007.debug.txt
#0 0x00007fb16e32a145 in malloc () from /lib/ld-musl-x86_64.so.1
No symbol table info available.
#1 0x0000000000000001 in ?? ()
No symbol table info available.
#2 0x00007fb16e0edebf in operator new(unsigned long) () from /usr/bin/../lib/libstdc++.so.6
No symbol table info available.
#3 0x0000560c2d0fb23e in getMemory (numWords=2)
at /home/builder/package/llvm-project/llvm/lib/Support/APInt.cpp:46
No locals.
#4 0x0000560c2d0fb387 in llvm::APInt::initSlowCase (this=0x7fb16bd42270, that=...)
@lygstate
lygstate / gist:b3a7de98eb923e72dea6a14ae16c1dc5
Created December 25, 2019 18:17
core.1577293036.ld.lld.44630.reldeb.txt
#0 0x00005573b440d7d2 in computeKnownBits (V=0x5573efdf4a18, Known=..., Depth=5, Q=...)
at /home/builder/package/llvm-project/llvm/include/llvm/IR/Type.h:223
BitWidth = 128
ScalarTy = 0x5573f4235fb0
ExpectedWidth = <optimized out>
C = <optimized out>
#1 0x00005573b4417baf in computeKnownBitsMul (Op0=0x5573f11d78f8, Op1=0x5573efdf4a18, NSW=false,
Known=..., Known2=..., Depth=4, Q=...)
at /home/builder/package/llvm-project/llvm/lib/Analysis/ValueTracking.cpp:326
BitWidth = 128