Skip to content

Instantly share code, notes, and snippets.

View youthlin's full-sized avatar

Youth.霖 youthlin

View GitHub Profile
@acheong08
acheong08 / htmj.js
Created November 5, 2023 17:21
HTMX but with JSON
class HTMJ {
constructor() {
this.init();
}
init() {
document.addEventListener("DOMContentLoaded", () => {
this.parseTemplates();
});
}
@liangzai-cool
liangzai-cool / gitee.com-2-github.com.sh
Last active May 18, 2021 11:59
gitee.com所有仓库同步到github私有仓库
source_code_dir="~/sourcecode/gitee.com/"
token="your_gitee_com_token"
gh_token="your_github_com_token"
current_dir=$(pwd)
response=$(curl -X GET "https://gitee.com/api/v5/user/repos?access_token=${token}&sort=created&page=1&per_page=20")
project_count=$(echo $response | jq '. | length')
echo $project_count
for(( i = 0; i < $project_count; i = i + 1 ))
do
operation="clone"
@goodevilgenius
goodevilgenius / fortune_variety_quotes.py
Last active October 28, 2023 05:09
[Variety fortune plugin] Plugin for Variety background changer that uses the UNIX fortune program as a quotes source
#!/usr/bin/python
from variety.plugins.IQuoteSource import IQuoteSource
import subprocess, re
from locale import gettext as _
class FortuneSource(IQuoteSource):
@classmethod
def get_info(cls):
return {
@klange
klange / _.md
Last active December 2, 2023 20:36
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
@wendal
wendal / test.java
Created August 28, 2012 05:13
获取Classpath中所有jar的路径
public static void main(String[] args) throws Throwable {
Enumeration<URL> urls = SimpleDaoTest.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
while (urls.hasMoreElements()) {
URL url = (URL) urls.nextElement();
System.out.println(url);
}
}
@yangbajing
yangbajing / gist:2601146
Created May 5, 2012 09:17
基于cookie的WEB自动登陆功能设计和账户安全性

基于cookie的WEB自动登陆功能设计和账户安全性

目标

设计一个基于cookie的安全的自动登陆功能。 简单说就是不在cookie中保存密码,且token值在每次使用后都会更新 ( 类似lift那样 )

计划