Skip to content

Instantly share code, notes, and snippets.

View 0xKayvan's full-sized avatar
💻
In code we trust.

Kayvan Nouri 0xKayvan

💻
In code we trust.
  • Mordor
View GitHub Profile
import SwiftUI
@main
struct Medium: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import axios, { AxiosRequestConfig } from 'axios'
const domainName = 'example.com'
const auth = 'Bearer POT_YOUR_TOKEN_HERE';
(async () => {
try {
let requestConfig: AxiosRequestConfig = {
@0xKayvan
0xKayvan / gist:d8056919ac4f529f98b050ce73a7254c
Created April 16, 2021 14:53
Fix iphone connection issue in mac
sudo killall -STOP -c usbd
@0xKayvan
0xKayvan / folder-structure.txt
Last active October 29, 2020 19:18
folder structure
- ChatApplication
|- Documents
|- Doucumentations
|- Resources
|- Sources
|- backend
|- iOS
#!/bin/sh
DIR=`date +%Y-%m-%d-%H-%M-%S`
DEST=/root/db_backups/$DIR
mkdir $DEST
mongodump -o $DEST
scp -r /root/db_backups/$DIR 7030backup:/root/mongodb_backups/$DIR
var Promise = require('bluebird');
doTask1()
.then(doTask2)
.then(doARecursiveTask)
.then(doFinalTask)
.then(function (fullfilled) {
console.log('that last thing is:', fullfilled)
console.log('[DOOOOOOOOONEEEE]')
})
@0xKayvan
0xKayvan / gist:fbf8b8f8f108916082a6628bc71bccd8
Created February 22, 2017 06:00
remove all docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@0xKayvan
0xKayvan / reloadData.m
Created November 12, 2015 20:38
reloadData so the device rotation would be more smooth
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width > size.height) {
[self.tableView reloadData];
}
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if (size.width < size.height) {
[self.tableView reloadData];
}
@0xKayvan
0xKayvan / gitlab-reenable-signin.sh
Last active January 3, 2024 20:56
enable gitlab sign-in after accidentally disable it in admin
sudo gitlab-rails console
ApplicationSetting.last.update_attributes(signin_enabled: true)
exit
sudo gitlab-ctl restart
@0xKayvan
0xKayvan / showPHPErrors.php
Last active November 12, 2015 20:39
show php error in brower
<?php
ini_set('display_errors','On');
error_reporting(E_ALL);