Skip to content

Instantly share code, notes, and snippets.

@yihong0618
yihong0618 / shanbay_remember.js
Last active December 1, 2022 04:40
扇贝加密破解自动发送今日新词到 telegram
const https = require("https");
const token = ""; // change this to you telegram bot token!
const chatId = ""; // change this to your telegram chat id!
const cookie = ""; // change this to your shanbay cookie!
const PATH_API = (page) =>
`/wordsapp/user_material_books/blozps/learning/words/today_learning_items?ipp=10&page=${page}&type_of=NEW`;
const options = {
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
FROM elixir:1.9.1-alpine as build
# # install build dependencies
RUN apk add --no-cache \
gcc \
g++ \
git \
make \
musl-dev
RUN mix do local.hex --force, local.rebar --force
@rcdilorenzo
rcdilorenzo / macro_fun.exs
Created January 30, 2015 03:27
Macro fun in Elixir mimicking Ruby's attr_accessor
defmodule MacroExp do
defmacro attr_accessor(atom) do
getter = String.to_atom("get_#{atom}")
setter = String.to_atom("set_#{atom}")
quote do
def unquote(getter)(data) do
data |> Map.from_struct |> Map.get(unquote(atom))
end
def unquote(setter)(data, value) do
data |> Map.put(unquote(atom), value)
@willurd
willurd / web-servers.md
Last active May 7, 2024 04:58
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then
source "$rvm_path/scripts/rvm"
rvm use `cat .ruby-version`@`cat .ruby-gemset`
fi
@sanpingz
sanpingz / count.py
Created May 25, 2013 09:41
unicode字符计数
#!/usr/bin/env python
#-*- coding:utf8 -*-
import re
import urllib
def counter(url, start, end):
p = urllib.urlopen(url).read().decode('utf8')
art = r'(?s)(?=%s).*?(?<=%s)' % (start, end)
article = re.findall(art, p)[0]
# print article
@benbalter
benbalter / jekyll-drafts.md
Last active March 12, 2024 07:39
Example of using drafts in Jekyll

Let's say your Jekyll site's directory structure looks like:

|-- _config.yml
|-- _drafts/
|   |-- a-draft-post.md
|-- _layouts/
|   |-- default.html
|-- _posts/
| |-- 2013-05-10-a-published-post
@gcmurphy
gcmurphy / autosave.js
Created September 6, 2012 05:43
Very simple autosave functionality using local storage
var AutoSave = (function(){
var timer = null;
function getEditor(){
var elems = document.getElementsByTagName("textarea")
if (elems.length <= 0)
return null;
@zhimiaoli
zhimiaoli / markdown.css
Created August 28, 2012 15:11
github的markdown的样式
.markdown-body {
font-size: 14px;
line-height: 1.6;
}
.markdown-body > *:first-child {
margin-top: 0 !important;
}
.markdown-body > *:last-child {
margin-bottom: 0 !important;
}