Skip to content

Instantly share code, notes, and snippets.

View stilllisisi's full-sized avatar
🎯
Focusing

stilllisisi

🎯
Focusing
View GitHub Profile
@stilllisisi
stilllisisi / exception.py
Last active February 18, 2020 03:14 — forked from banjin/优秀代码集合...
【python-异常处理】忽略异常的处理
忽略抛出的异常:
常用的写法:
try:
os.remove('somefile.tmp')
except OSError:
pass
@stilllisisi
stilllisisi / callee.js
Last active February 18, 2020 03:12 — forked from dreamsky/callee.js
【JavaScript-列表/字典处理】优秀的 JavaScript 代码片段集合
//JavaScript callee 用法示例
function factorial(num) {
if (num <= 1) {
return 1;
} else {
return num * arguments.callee(num - 1);
}
}
@stilllisisi
stilllisisi / gist:9409eda29e3a1828c2e8627b7b0501fa
Last active February 18, 2020 03:11 — forked from Quasimo/gist:1139189
【python-字符串/正则表达式】新手常用代码片段
# via: http://www.oschina.net/code/snippet_16840_1568
1.生成随机数
import random #这个是注释,引入模块
rnd = random.randint(1,500)#生成1-500之间的随机数
2.读文件
f = open("c:\\1.txt","r")
lines = f.readlines()#读取全部内容
@stilllisisi
stilllisisi / 文件按行读取.go
Last active March 13, 2020 09:57 — forked from ma6174/文件按行读取.go
【GO-文件/目录处理】文件按行读取
f, err := os.Open("a.txt")
defer f.Close()
if nil == err {
buff := bufio.NewReader(f)
for {
line, err := buff.ReadString('\n')
if err != nil || io.EOF == err{
break
}
fmt.Println(line)
@stilllisisi
stilllisisi / postgres_array.go
Created February 28, 2020 02:53 — forked from adharris/postgres_array.go
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@stilllisisi
stilllisisi / README.md
Created February 28, 2020 03:52 — forked from eliquious/README.md
Golang OpenPGP examples

Building

go build -o goencrypt main.go

Generating Keys

@stilllisisi
stilllisisi / structs_interface.go
Created February 28, 2020 03:53 — forked from josephspurrier/structs_interface.go
Golang - Understand Structs and Interfaces
// Also available at: https://play.golang.org/p/yTTpB5gB6C
package main
import (
"fmt"
)
// *****************************************************************************
// Example 1 - Struct vs Struct with Embedded Type
@stilllisisi
stilllisisi / CircleTransformation.kt
Created March 10, 2020 01:48 — forked from G00fY2/CircleTransformation.kt
Circle image transformation for Picasso 3 which handles API 26+ hardware bitmaps
import android.graphics.Bitmap
import android.graphics.Bitmap.Config
import android.graphics.BitmapShader
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Shader
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import com.squareup.picasso3.RequestHandler
import com.squareup.picasso3.Transformation
@stilllisisi
stilllisisi / CircleImageTransformation.java
Created March 10, 2020 01:48 — forked from codezjx/CircleImageTransformation.java
A picasso circle image transformation. Optimized version of: https://gist.github.com/julianshen/5829333. Use shader.setLocalMatrix() method to draw circle bitmap not from source bitmap left-top. So, we no need to create square bitmap!
/**
* Created by codezjx on 2016/5/4.
*/
public class CircleImageTransformation implements Transformation {
/**
* A unique key for the transformation, used for caching purposes.
*/
private static final String KEY = "circleImageTransformation";
@stilllisisi
stilllisisi / T0.md
Created March 10, 2020 02:13 — forked from graphitemaster/T0.md
Vulkan Tutorial

Tutorial 0

What is Vulkan

Vulkan is a low-overhead, cross-platform 3D graphics and compute API.

Vulkan targets

Vulkan targets high-performance realtime 3D graphics applications such as games and interactive media across multiple platforms providing higher performance and lower CPU usage.