Skip to content

Instantly share code, notes, and snippets.

View cagataycali's full-sized avatar

./c² cagataycali

View GitHub Profile
@carver
carver / UnsafeERC20.sol
Last active October 31, 2018 12:46
Unsafe ERC20 Example for Web3.py Workshop
pragma solidity ^0.4.25;
// This contract is an example, not to be used in production
// One example issue is that there are potential overflow/underflow bugs.
contract UnsafeERC20 {
mapping (address => uint256) private _balances;
uint256 private _totalSupply;
@cagataycali
cagataycali / backend.js
Last active June 12, 2019 17:19
Nodemcu ve LCD ile web sitesindeki online sayacı
const io = require('socket.io')()
let user = 0
io.on('connection', socket => {
++user
console.log('Someone connected');
io.sockets.emit('event', `${user} Online`)
@jackton1
jackton1 / drf_optimize.py
Last active October 6, 2023 22:37
Optimize Django Rest Framework model views queries.
from django.db import ProgrammingError, models
from django.db.models.constants import LOOKUP_SEP
from django.db.models.query import normalize_prefetch_lookups
from rest_framework import serializers
from rest_framework.utils import model_meta
class OptimizeModelViewSetMetaclass(type):
"""
This metaclass optimizes the REST API view queryset using `prefetch_related` and `select_related`
if the `serializer_class` is an instance of `serializers.ModelSerializer`.
@vural
vural / megep.json
Last active March 13, 2018 07:35
megep.json
This file has been truncated, but you can view the full file.
@cagataycali
cagataycali / TODO-LIST.md
Last active January 31, 2018 20:31
Nightmare js runner

.1

sudo apt-get update && sudo apt-get install -y xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps clang libdbus-1-dev libgtk2.0-dev libnotify-dev libgnome-keyring-dev libgconf2-dev libasound2-dev libcap-dev libcups2-dev libxtst-dev libxss1 libnss3-dev gcc-multilib g++-multilib

.2

DEBUG=nightmare xvfb-run --server-args="-screen 0 1024x768x24" node index.js

.3

pm2 start run.sh --name demo

@osoner
osoner / countly.clean.db.js
Created July 27, 2012 10:14
Countly - Clean server data
/*
Usage;
$ mongo countly countly.clean.db.js
*/
db.sessions.remove()
db.users.remove()
db.carriers.remove()
db.locations.remove()
db.realtime.remove()