Skip to content

Instantly share code, notes, and snippets.

View co3moz's full-sized avatar
🍗
increasing the entropy

Doğan Derya co3moz

🍗
increasing the entropy
View GitHub Profile
@co3moz
co3moz / list.txt
Last active March 29, 2023 10:09
stargate sg-1 episode skip or not list
A) just-skip
B) crappy episode
C) maybe watch or just skip all
D) maybe watch or skip some parts
E) non-important episode but not bad one
F) important episode but skipping is sometimes required
1.3rd / S1E4 (A)
1.5th / S1E6 (C, god-dilemma stuff)
1.15th / S1E16 (C, trial stuff)
@co3moz
co3moz / css2modulecss.md
Last active December 7, 2020 19:28
*.css to *.module.css

SEARCH

(?<!:local\(|:global\()(\.[a-zA-Z\-0-9]+)(?!;)

Note: don't forget to skip numbers

REPLACE TO

:global($1)
@co3moz
co3moz / js-literal.example.ts
Last active June 5, 2020 15:58
Node.js template literal function for executing code in sandbox environment
import { js } from './js-literal';
// easy call
let result = js()`1`;
// auto context
let result2 = js()`${result}`;
assert(result === result2);
// auto context, objects
@co3moz
co3moz / example.tsx
Last active October 18, 2019 17:05
React validator form component
const PAGE_KEYS_CREATE: React.FC = () => {
return <Form
submit={(data) => console.log(data)}
submitText="Create"
fields={{
name: {
label: 'Name',
type: 'text',
validation: GenericTextValidation
@co3moz
co3moz / lock.ts
Last active July 17, 2019 02:47
Locking mechanism for critical tasks with basic deadlock prevention and acquire timeout features
export class Lock {
private chain: Promise<any> = Promise.resolve(null);
busy = false;
acquire(deadlockSafeTimeout = 0, acquireTimeout = 0) {
let acquireTimeoutId: any = null;
let acquireFailed = false;
let unlock: () => void;
let unlockingPromise = new Promise(r => unlock = r);
@co3moz
co3moz / async lock.js
Created January 27, 2019 13:34
crappy lock mechanism for js, "minor projects"
function deferred() {
let r;
let p = new Promise(a => r = a);
p.r = r;
return p;
}
function lock() {
let queue = [];
let locked = false;
return {
@co3moz
co3moz / thecrims-bukakale.js
Last active May 21, 2018 15:09
thecrims-bot
var getRobberies = function (done) {
console.log('%c Soygun seçiliyor.', 'background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function (res) {
done(res.single_robberies
.filter(robbery => robbery.successprobability == 100)
.sort((a, b) => b.difficulty - a.difficulty)
.find((x, index) => index == 0))
@co3moz
co3moz / asyncForeach.js
Last active May 7, 2018 16:10
primitive asyncMap and asyncForeach methods for primitive environment
function asyncForeach(array, fn, atEnd) {
var at = -1;
function next(shouldBreak) {
if (shouldBreak || ++at == array.length) {
if (atEnd) {
setTimeout(atEnd);
}
} else {
setTimeout(fn, 0, array[at], next);
}
@co3moz
co3moz / tckimlik.js
Last active November 9, 2022 11:29
TC Kimlik no doğrulama, adam akıllı sürümü
// Millet evalle tc kimlik doğrulama yazmış. Manyak la bunlar
// 10. satırda 7 * t - c negatif çıkması durumunda hesabın bozulmaması için +30 yapılmıştır. (Bazı insanların negatif çıkabiliyor)
function tcKimlikKontrol(s) {
if (!(/^[1-9]\d{9}[02468]$/.test(s))) return false;
var t = +s[0] + +s[2] + +s[4] + +s[6] + +s[8],
c = +s[1] + +s[3] + +s[5] + +s[7];
if (s[9] != ((30 + t * 7 - c) % 10)) return false;
alias biggestfile='du -cks * | sort -rn | head'
alias freedisk='df -h'
alias foldersize='du -hs'