Skip to content

Instantly share code, notes, and snippets.

View fatihmert's full-sized avatar
🥳

Fatih Mert Doğancan fatihmert

🥳
View GitHub Profile
@aruld
aruld / foreachmap.dart
Created October 19, 2011 18:29
Dart forEach() on a Map
main() {
Map<String, int> map = {
'one': 1,
'two': 2,
'twelve': 12};
void iterateMapEntry(key, value) {
map[key] = value;
print('$key:$value');//string interpolation in action
}
@krmahadevan
krmahadevan / webconfig.txt
Last active May 6, 2020 16:26
A JSON configuration file that can be used to spawn a webdriver node.
{
"capabilities":
[
{
"browserName":"firefox",
"acceptSslCerts":true,
"javascriptEnabled":true,
"takesScreenshot":true,
"firefox_profile":"",
"maxInstances":5
@armicron
armicron / hello_world_into_file.asm
Created October 10, 2016 12:35
NASM x86_64 open file and write 'Hello world'
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
mov rdi, filename
mov rsi, 0102o ;O_CREAT, man open
mov rdx, 0666o ;umode_t
mov rax, 2
syscall
@muralikg
muralikg / background.js
Last active June 8, 2023 09:19
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@saltun
saltun / gist:b4c117641461177523ef
Created July 5, 2014 12:39
Laravel validation.php Türkçe [ TR]
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
@collinjackson
collinjackson / main.dart
Last active August 17, 2023 20:06
PageView example with dots indicator
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
@fnky
fnky / hooks.js
Last active January 7, 2024 12:32
React Hooks: useReducer with actions and selectors (Redux-like)
function useSelectors(reducer, mapStateToSelectors) {
const [state] = reducer;
const selectors = useMemo(() => mapStateToSelectors(state), [state]);
return selectors;
}
function useActions(reducer, mapDispatchToActions) {
const [, dispatch] = reducer;
const actions = useMemo(() => mapDispatchToActions(dispatch), [dispatch]);
return actions;
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
vec2 rotate(vec2 v, float a) {
float s = sin(a);
float c = cos(a);
mat2 m = mat2(c, s, -s, c);
return m * v;
}
@scottyab
scottyab / SignatureCheck.java
Last active January 30, 2024 15:22
Simple Android signature check. Please note: This was created in 2013, not actively maintained and may not be compatible with the latest Android versions. It's not particularly difficult for an attacker to decompile an .apk, find this tamper check, replace the APP_SIGNATURE with theirs and rebuild (or use method hooking to return true from `vali…
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
public class TamperCheck {
//we store the hash of the signture for a little more protection
private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846";