Skip to content

Instantly share code, notes, and snippets.

@chfritz
chfritz / squeezing.tex
Created December 5, 2013 23:15
A tex file full of tricks for squeezing a latex document. Clearly you should avoid using these tricks. But when the deadline is near and you see no other way, you can use it to quickly change the formatting slightly to get more space. Just comment in some of the length changes or add other for the described sizes.
%% /** ---------------------------------------------------------
%% a file full of squeezing options
%% -- which you should try to avoid
%% -------------------------------------------------------------
%%
%% from:
%% http://www.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html
%% ---------------------------------------------------------- */
%% * Page Layout
%% o \columnsep: gap between columns
@paulirish
paulirish / args.gn
Last active May 17, 2024 00:09
How to build Chromium to hack on DevTools
# Build arguments for the gn build
# You can set these with `gn args out/Default`
# ( and they're stored in src/out/Default/args.gn )
# See "gn args out/Default --list" for available build arguments
# component build, because people love it
is_component_build = true
# release build, because its faster
is_debug = true
@Jarmos-san
Jarmos-san / main.py
Last active May 17, 2024 00:07
A simple FastAPI project with a health check route
"""Entrypoint to invoke the FastAPI application service with."""
from fastapi import FastAPI, status
from pydantic import BaseModel
import uvicorn
app = FastAPI()
class HealthCheck(BaseModel):
@benchonaut
benchonaut / README.md
Last active May 16, 2024 23:58
firefox-restore-jsonlz4-dump

FckUfox ( Firefox ) session jsonlz4 recovery from sessionstore-backup

note: Firefox will be subsequently called FckUfox in this doc

edit 2022: TRY TO AVOID FCKUFOX AS MUCH AS POSSIBLE ; FCKUFOX WILL waste

if any firefox accountable person ever reads this:

var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@kennwhite
kennwhite / 1944_OSS_Simple_Sabotage_Field_Manual.md
Last active May 16, 2024 23:54
1944 OSS Simple Sabotage Field Manual
@DarrenSem
DarrenSem / dtString.js
Created November 6, 2022 20:02
dtString.js (dateArg, includeTime, defaultDate, defaultReturnValue) '1-2-2022 1:00' returns '02Jan2022 100am' or '02Jan2022'
// dtString.js (dateArg, includeTime, defaultDate, defaultReturnValue) '1-2-2022 1:00' returns '02Jan2022 100am' or '02Jan2022'
const assert=(...a)=>!a.reduce((b,c,d,e,f)=>(f=("function"==typeof c?!c():!c)&&[2>a.length?c:`<arg #${d+1}> ${a.map((a,b)=>`#${b+1} = [ ${a} ]`).join(" , ")}`],f&&console.assert(0,...b[b.push(f)-1]),b),a.length?[]:[a]).length;
const assertMessage = (test, ...messageAndSubstitutions) => assert(test) || console.error(...messageAndSubstitutions) || false;
console.clear();
// 183 chars: const dtString=(a,b,c,e,f=new Date(a),[,,,,g,h,,i]=(f=+f?f:new Date(c)).toLocaleString().toLowerCase().split(/\W/),[,j,k,d]=f.toString().split(" "))=>isNaN(f)?e:`${k}${j}${d}${b?` ${g}${h}${i}`:""}`
const dtString = (dateArg, includeTime, defaultDate, defaultReturnValue, z = new Date(dateArg), [, , , , h, n, , ampm] = (z = +z ? z : new Date(defaultDate)).toLocaleString().toLowerCase().split(/\W/), [, m, d, y] = z.toString().split(" ")) => isNaN(z) ? defaultReturnValue : `${d}${m}${y}${includeTime ? `
@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@nkhitrov
nkhitrov / structlog_fastapi.py
Created March 16, 2023 00:04
Structlog FastAPI example
"""
Structlog example configuration with FastAPI.
Features:
- async bound logger
- contextvars to log request-id and other meta data
- custom format for default logging loggers and structlog loggers
"""
import asyncio
import logging
@faytey
faytey / commitmentscheme.rs
Created May 16, 2024 19:05
commitment scheme
use std::{error::Error, hash::{DefaultHasher, Hash, Hasher}};
trait Auction {
fn commit(a: u8, b: u8) -> Result<Vec<u8>, Box<dyn Error>>;
fn open(input: u8, commitment: Vec<u8>) -> Result<bool, Box<dyn Error>>;
}
struct Auctioning {}
impl Auctioning {
fn to_hash(value: u8) -> Vec<u8> {