Skip to content

Instantly share code, notes, and snippets.

@slowkow
slowkow / remove-emoji.py
Created July 19, 2018 14:10
Remove all traces of emoji from a text file.
View remove-emoji.py
#!/usr/bin/env python
"""
Remove emoji from a text file and print it to stdout.
Usage
-----
python remove-emoji.py input.txt > output.txt
"""
View streaming-json-parser.ts
const CH_BRACE_L = 0x7b as const;
const CH_BRACE_R = 0x7d as const;
const CH_SQUARE_L = 0x5b as const;
const CH_SQUARE_R = 0x5d as const;
const CH_QUOTE_D = 0x22 as const;
const CH_ESCAPE = 0x5c as const;
const CH_COMMA = 0x2c as const;
const CH_COLON = 0x3a as const;
const CH_DOT = 0x2e as const;
const CH_MINUS = 0x2d as const;
View onekey-NeverIdle.sh
#!/bin/bash
# Author: An Shen
# Date: 2023-01-30
. /etc/profile
function log(){
echo "[$(date +'%Y-%m-%d %H:%M:%S')] - $1"
}
View gist:747922
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><link rel="canonical" href="http://books.google.com/books?id=NyIXAAAAYAAJ"/><title>Excavations at Carnac (Brittany): a ... - Google Books</title><script>(function(){function a(d){this.t={};this.tick=function(e,f,b){b=b?b:(new Date).getTime();this.t[e]=[b,f]};this.tick("start",null,d)}var c=new a;window.jstiming={Timer:a,load:c};try{var g=null;if(window.chrome&&window.chrome.csi)g=Math.floor(window.chrome.csi().pageT);if(g==null)if(window.gtbExternal)g=window.gtbExternal.pageT();if(g==null)if(window.external)g=window.external.pageT;if(g)window.jstiming.pt=g}catch(h){};})();
</script><script>(function() {var preloadImg = document.createElement('img');preloadImg.src = 'http://books.google.com/books?id=NyIXAAAAYAAJ&pg=PA29&img=1&zoom=3&hl=en&q=jaquemet&sig=ACfU3U1Y4HWCC-GoEln9B0N8DaoAvynI5A&w=685';window['_OC_preload_image_url'] = preloadImg.src;})();</script><link rel="stylesheet" href="/books/
@78526Nasir
78526Nasir / Secant.java
Created December 20, 2017 16:57
Secant method implementation in java.
View Secant.java
/*
@ Author: Nasir Islam Sujan
@ GitHub: https://github.com/78526Nasir
*/
/*
* This solution was written for
* the following equation
* f(x) = x^3 - 0.165x^2 + 3.993 * 10^-4
You need an absolute relative approximate error of 5% or less.
@ksafranski
ksafranski / Common-Currency.json
Last active June 4, 2023 14:23
Common Currency Codes in JSON
View Common-Currency.json
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@raspberrypisig
raspberrypisig / CMakeLists.txt
Last active June 4, 2023 14:18
msys2 vscode integration c++ vcpkg cmake
View CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project (roguelike-firststab)
set(SDL2_DIR "C:/msys64/mingw64/bin/vcpkg/installed/x64-mingw-static/share/sdl2")
set(glad_DIR "C:/msys64/mingw64/bin/vcpkg/installed/x64-mingw-static/share/glad")
set(lodepng-c_DIR "C:/msys64/mingw64/bin/vcpkg/installed/x64-mingw-static/share/lodepng-c")
set(libtcod_DIR "C:/msys64/mingw64/bin/vcpkg/installed/x64-mingw-static/share/libtcod")
find_package(libtcod CONFIG REQUIRED)
add_executable(roguelike-firststab main.cpp)
target_link_libraries(roguelike-firststab PRIVATE libtcod::libtcod)
add_definitions(-DSDL_MAIN_HANDLED)
@Skyross
Skyross / task_with_lock.py
Last active June 4, 2023 14:17
Celery Task with lock
View task_with_lock.py
from celery import Task
from django.conf import settings
from django.core.cache import caches
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
# noinspection PyAbstractClass
class TaskWithLock(Task):
"""
@mailme-gx
mailme-gx / eml2maildir.sh
Last active June 4, 2023 14:16 — forked from targzeta/eml2maildir.sh
Traslates .eml file to maildir format.
View eml2maildir.sh
#!/bin/bash
# Copyright (C) 2015
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
View FloatingPanel.swift
class FloatingPanel: NSPanel {
init(contentRect: NSRect, backing: NSWindow.BackingStoreType, defer flag: Bool) {
// Not sure if .titled does affect anything here. Kept it because I think it might help with accessibility but I did not test that.
super.init(contentRect: contentRect, styleMask: [.nonactivatingPanel, .resizable, .closable, .fullSizeContentView], backing: backing, defer: flag)
// Set this if you want the panel to remember its size/position
// self.setFrameAutosaveName("a unique name")
// Allow the pannel to be on top of almost all other windows