This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// place into ~/.config/systemd/user/your-service-file.service | |
// more info: https://www.unixsysadmin.com/systemd-user-services/ | |
[Unit] | |
Description=Run dummy service as user X | |
DefaultDependencies=no | |
After=network.target | |
[Service] | |
Type=simple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go func() { | |
reader := bufio.NewReader(os.Stdin) | |
for { | |
input, _, err := reader.ReadLine() | |
if err != nil { | |
fmt.Printf("could not process input %v\n", input) | |
} | |
switch string(input) { | |
case "hello": | |
fmt.Println("hello world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"net/http" | |
"os" | |
"os/signal" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace Mvvm | |
{ | |
public class Ioc | |
{ | |
private static Dictionary<Type, object> classes = new Dictionary<Type, object>(); | |
public static void Register<T>(params object[] parameters) where T : class | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// reading data from any source | |
$array = call_procedure_here(); | |
$output = '<?php' . PHP_EOL . '$myarray = ' . var_export($array, true) . ';' . PHP_EOL . '?>'; | |
file_put_contents(__DIR__ . '/cache/cache_file.php', $output); | |
// include in other files | |
include __DIR__ . '/cache/cache_file.php'; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// just an example object | |
MyObj obj = // receive from somewhere | |
object temp = new object(); | |
PropertyInfo[] properties = typeof(obj).GetProperties(); | |
foreach (PropertyInfo property in properties) | |
{ | |
var name = property.Name; // gets the name of the property as a string | |
var value = property.GetValue(temp, null); // get the value of the property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install NuGet package WindowsAPICodePack-Shell by Aybe | |
// | |
// using Microsoft.WindowsAPICodePack.Dialogs; | |
CommonOpenFileDialog dialog = new CommonOpenFileDialog(); | |
dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); | |
dialog.IsFolderPicker = true; | |
if (dialog.ShowDialog() == CommonFileDialogResult.Ok) | |
{ | |
Debug.WriteLine(dialog.FileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From: https://github.com/nitin42/Python-Automation/blob/master/project15.py | |
# Brute-Force PDF Password Breaker | |
# Brute-Forcing the pdf files to break the encryption using dictionary attack | |
import os | |
import PyPDF2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.idea/ | |
/.git/ | |
/vendor/ | |
/var/* | |
!/var/cache | |
/var/cache/* | |
!var/cache/.gitkeep | |
!/var/lock | |
/var/lock/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Source: https://www.jodyhatton.com/how-big-is-my-website-how-to-get-a-list-of-all-files-and-folders-directories-using-php/ | |
*/ | |
$pathLen = 0; | |
function prePad($level) | |
{ | |
$ss = ""; | |