Skip to content

Instantly share code, notes, and snippets.

View yne's full-sized avatar
✔️
Not a virus

Rémy F. yne

✔️
Not a virus
View GitHub Profile
#http://d{u,e,o}01{,b}.psp.update.playstation.org/update/psp/image{,2}/{eu,us}/$date_$md5/EBOOT.PBP
6be8878f475ac5b1a499b95ab2f7d301 6.61
2011_0810 2ca64d59dcf48f45fb99b400a586b395 6.60
ccce1a0f3ba08e22c26ec5bc047a0063 6.39
d033298a1de455a5d90e06f91c6802f6 6.38
2011_0120 5a21c511c90ed765747c43a9779f7a4b 6.37
bcac2b0a4ac55378f300386391e4bb37 6.36
2010_1124 5945c21abfa5b1221adda745f9417668 6.35
2010_0729 d7ea54162d2d53c5efb46648ee12f6bc 6.31
@yne
yne / kh_diff.c
Created February 13, 2017 23:45
khash diff example
#include <inttypes.h>
#include <stdio.h>
//#include "klist.h"
#include "khash.h"
#define kh_forall(h) for(khint_t __i=kh_begin(h);__i!=kh_end(h);++__i)if(kh_exist(h,__i))
#define kh_diff(name, old, new, on_add, on_keep, on_del)\
kh_forall(new){/*find added(exist in new, not in old) and kept(exist in both) entries */\
khiter_t __j = kh_get(name, old, kh_key(new,__i));\
if((__j==kh_end(old))||(!kh_exist(old,__j))){on_add;}else{on_keep;}\
@yne
yne / upnp_port.c
Created March 12, 2017 02:18
UPNP port forwarding managment
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <ctype.h>
#include "miniwget.h"
#include "miniupnpc.h"
#include "upnpcommands.h"
@yne
yne / git.io yne.install
Last active November 4, 2022 05:00
wget -O- git.io/yne.install | bash
#!/bin/bash
set -x
until sudo apt -y update && sudo apt -y upgrade ; do sleep 10; done
crontab -l | grep -q .wall || (echo '0 * * * * ID=$(curl -sL gist.githubusercontent.com/yne/729655bd0557bfde7a088e15b40b9e6d/raw/ | shuf -n 1);for t in jpg png; do curl -sfL nik.bot.nu/o$ID.$t -o "$HOME/.wall"; done') | crontab -
# MS-EDGE
REPO_EDGE='https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-dev/'
LAST_EDGE=$(wget -qO- "$REPO_EDGE" | grep -o '[.a-z_0-9-]*.deb' | tail -n1)
wget -O /tmp/edge_amd64 "$REPO_EDGE/$LAST_EDGE"
# VSCode (will add itself to apt.list)
@yne
yne / generic.lambda.c
Created August 12, 2018 17:33
C11 Lambda + Generic
#include <stdio.h>
#define fn(c) ({int _ c;_;})
#define list(c) sizeof(c)/sizeof(*c),c
#define map(LIST, CB) _Generic( (CB), int(*)(int, int, int*): map_arr, int(*)(int): map_val)(list(LIST), CB)
int map_val(size_t total, int *array, int (*cb)(int)) {
for(int i = 0; i < total; i++)
array[i] = cb(array[i]);
}
int map_arr(size_t total, int *array, int (*cb)(int, int, int*)) {
@yne
yne / dom.c
Created August 18, 2018 13:06
#include <stdio.h>
#include <stdint.h>
#include <termios.h>
#define LEN(ARR) ARR,sizeof(ARR)/sizeof(*ARR)
#define RGBA(R,G,B,A) ((R<<24) | (G<<16) | (B<<8) | A)
#define RGB(R,G,B) RGBA(R,G,B,255)
typedef enum{
RULE_NOP,
RULE_TEXT_COLOR,
@yne
yne / csv2vcf.js
Last active July 6, 2019 21:15
Convert csv from outlook exported contact to android compliant vcard file
csv.split('\n').slice(1).filter(e=>e).map(l=>l.split(',')).map(a=>['BEGIN:VCARD','VERSION:2.1','N:'+[a[2],a[0],a[1]].join(';'),...a.slice(11,24).map(m=>`TEL;CELL:`+m),...a.slice(8,11).map(m=>'EMAIL;HOME:'+m),'END:VCARD'].filter(l=>!l.endsWith(':')).join('\n')).join('\n\n')
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/epoll.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@yne
yne / av1.c
Created August 20, 2019 18:02
av1-like decoder
#include <math.h>
#include <stdio.h>
#define e(a, d) for(a=0;a<d;a++)
int YUV[3][1 << 20], tmpyuv[2048], scratch[166], width;
int p = 0, r = 1;//reader accu
int lumaRatio = 0, satuRatio = 0;//decode default
void read8b() {
int b = getchar();
@yne
yne / spinner.css
Created December 25, 2019 22:16
spinner.css
.spinner{
color:transparent;
pointer-events:none;
user-select: none;
position: relative;
}
.spinner:after {
animation: dot 1s infinite;
content:"⠋";
color:initial;